package com.yj.generator.core;


import com.yj.generator.entity.GenerateOut;
import com.yj.generator.entity.Table;
import lombok.Data;

import java.util.List;

/**
 * @title 代码生成执行器
 * @author DengLin
 * @date 2024/07/05
 */
@Data
public class GenerateExecutor {

    private SqlExecutor sqlExecutor;

    public void execute(GenerateOut generateOut, List<String> tableNames) {
        List<Table> tables = this.sqlExecutor.getTables(tableNames);
        GenerateFileProxy generateFileProxy = new GenerateFileProxy();
        for (Table table : tables) {
            generateFileProxy.generate(generateOut, table);
        }
    }

    public GenerateExecutor(SqlExecutor sqlExecutor) {
        this.sqlExecutor = sqlExecutor;
    }
}
